package vn.hanelsoft.newsduet.view;

import vn.hanelsoft.newsduet.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class PopupLayout extends LinearLayout implements View.OnClickListener{

	LayoutInflater inflater;
	Context context;
	
	Button btn_facebook, btn_twitter, btn_google;
	SelectItem selectItem;
	
	public interface SelectItem{
		public void selectFacebook();
		public void selectTwitter();
		public void selectGoogle();
	}
	
	public PopupLayout(Context context) {
		super(context);
		
		this.context = context;
		inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.layout_popup, this);
		
		btn_facebook = (Button)findViewById(R.id.layout_popup_share_facebook);
		btn_twitter = (Button)findViewById(R.id.layout_popup_share_twitter);
		btn_google = (Button)findViewById(R.id.layout_popup_share_google);
		
		btn_facebook.setOnClickListener(this);
		btn_twitter.setOnClickListener(this);
		btn_google.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.layout_popup_share_facebook:
			selectItem.selectFacebook();
			break;
		case R.id.layout_popup_share_twitter:
			selectItem.selectTwitter();
			break;
		case R.id.layout_popup_share_google:
			selectItem.selectGoogle();
			break;

		default:
			break;
		}
		
	}
	
	public void setItemSelect(SelectItem selectItem){
		this.selectItem = selectItem;
	}

}
